package com.atguigu.yygh.hosp.controller.admin;

import com.atguigu.yygh.common.result.Result;
import com.atguigu.yygh.hosp.service.DepartmentService;
import com.atguigu.yygh.vo.hosp.DepartmentVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(tags = "医院科室接口")
@RestController
@RequestMapping("/admin/hosp/department")
//@CrossOrigin
public class AdminDepartmentController {
    @Autowired
    private DepartmentService departmentService;

    /** 排班分成三部分显示：
     *  1、科室信息（大科室与小科室树形展示）
     *  2、排班日期，分页显示，根据上传排班数据聚合统计产生
     *  3、排班日期对应的就诊医生信息
     *
     * @param hoscode
     * @return
     */
    @ApiOperation("根据医院编号查询医院所有科室列表")
    @GetMapping("getDepartmentList/{hoscode}")
    public Result getDepartmentListByHoscode(@PathVariable("hoscode") String hoscode) {
        // 根据医院编号,查询所有科室信息
        List<DepartmentVo> departmentList = departmentService.getDepartmentListByHoscode(hoscode);
        return Result.ok(departmentList);
    }


}
